package com.springcloudserver.service.impl;

import com.springcloudserver.domain.UserInfo;
import com.springcloudserver.mapper.UserInfoMapper;
import com.springcloudserver.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: chenzuolin
 * @time: 2021/3/20 21:20
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper baseMapper;

    @Override
    @Cacheable(cacheNames = "findUserInfoById", keyGenerator = "keyGenerator", sync = true)
    public UserInfo findUserInfoById(String id) {
        return baseMapper.selectById(id);
    }

    @Override
    @Cacheable(cacheNames = "findAllUserInfo", keyGenerator = "keyGenerator", sync = true)
    public List<UserInfo> findAllUserInfo() {
        return baseMapper.selectList(null);
    }
}
